# Contributor: Natanael Copa <ncopa@alpinelinux.org>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=hydrogen
pkgver=1.0.0_beta2
_ver=${pkgver/_beta/-beta}
pkgrel=1
pkgdesc="Advanced drum machine for GNU/Linux"
url="http://www.hydrogen-music.org/"
arch="aarch64 armv7 x86 x86_64" # ppc64le limited by ladspa, armhf by qt5-qtxmlpatterns
license="GPL-2.0-or-later"
makedepends="
	alsa-lib-dev
	cmake
	cppunit-dev
	flac-dev
	jack-dev
	ladspa-dev
	libarchive-dev
	libsndfile-dev
	portaudio-dev
	pulseaudio-dev
	qt5-qtbase-dev
	qt5-qttools-dev
	qt5-qtxmlpatterns-dev
	"
subpackages="$pkgname-dev $pkgname-doc"
source="hydrogen-$pkgver.tar.gz::https://github.com/hydrogen-music/hydrogen/archive/$_ver.tar.gz
	qt5.15.patch
	"
builddir="$srcdir"/hydrogen-$_ver

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake -B build \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		$CMAKE_CROSSOPTS .
	make -C build
}

check() {
	CTEST_OUTPUT_ON_FAILURE=1 make -C build tests
}

package() {
	make -C build DESTDIR="$pkgdir" install
}


sha512sums="8712996adbc820909d1d38ff7d45a2a49ec64c15135d5a99b08b93ebd5a0c05139ce78a317c274059a538eb68031f0f42bb9d22988312c2b9f60fa53c539a242  hydrogen-1.0.0_beta2.tar.gz
cbf8e7b479cf5f5a69403adf516574d82ea8a7d36a50f04699f216f8e7afd30a8a502636da84171ed4177ef1a492f51ff377950d24d93be727ebf57090e41ea8  qt5.15.patch"
